//
//  XMSBaseController.m
//  XMSimonUtils_Example
//
//  Created by 徐盟 on 2023/3/17.
//  Copyright © 2023 xumeng. All rights reserved.
//

#import "XMSBaseController.h"


@interface XMSBaseController ()

@end

@implementation XMSBaseController



- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    if (self.navItem != nil) {
        NSString * action = self.navItem.action;
        [self log:@"action=%@", action];
        SEL actionSel =  NSSelectorFromString(action);
        if ([self respondsToSelector:actionSel]) {
            [self log:@"action=%@ exist", action];
            [self performSelector:actionSel];
        }else{
            [self log:@"action=%@ not exist", action];
        }
    }
}


+(NSArray <NSDictionary *> *) getItemDicts
{
    NSArray<NSDictionary *> * dicts = @[];
    
    [XMLogger log:@"warning getItemDicts need to be overwritten "];
    return  dicts;
}

+(NSArray <XMSNavItem *> *) getNavItems
{
    NSMutableArray * models = [NSMutableArray array];
    NSArray<NSDictionary *> * dicts = [self getItemDicts];
    for (NSDictionary * dict in dicts) {
        XMSNavItem * item = [XMSNavItem selfWithDict:dict];
        [models addObject:item];
    }
    
    return  (NSArray *) models;
}



@end
